//
//  NetworkManager.h
//  BBProject
//
//  Created by Mxionlly on 16/5/20.
//  Copyright © 2016年 Mxionlly. All rights reserved.
//

#import "AFHTTPSessionManager.h"
#import <AFNetworking/AFNetworking.h>

typedef NS_ENUM(NSInteger,YBMNetworkRequestType)
{
    YBMNetworkRequestTypePost = 0,
    YBMNetworkRequestTypeGet = 1,
    YBMNetworkRequestTypePut = 2,
    YBMNetworkRequestTypeDelete,
};

typedef void (^failture)(NSError *error,NSString* strErrorMsg);
typedef void (^success) (NSURLSessionDataTask *operation, id responseObject, BOOL success);

@interface NetworkManager : AFHTTPSessionManager

#pragma mark - 网络单例  配置基本的网络参数
+ (instancetype)sharedManager;

/**
 *  POST GET 请求 基本请求
 *
 *  @param isload                  是否显示加载圈 YES:显示 NO:不显示
 *  @param requestType             请求方式
 */
- (NSURLSessionDataTask *)baseWithUrl:(NSString *)urlString
                           parameters:(NSDictionary *)parameters
                          requestType:(YBMNetworkRequestType )requestType
                            IsLoading:(BOOL )isload
                              success:(success)success
                             failture:(failture)failture;

//上传图片   单张图片
- (NSURLSessionDataTask *)uploadWithUrl:(NSString *)urlString
                             parameters:(NSDictionary *)parameters
                                  image:(UIImage *)image
                                 imgKey:(NSString *)imgKey
                                success:(success)success
                               failture:(failture)failture;
@end

